package com.dzm.controller.api;

import com.dzm.anno.RequirePermission;
import com.dzm.service.FileService;
import com.dzm.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 作者：Dzm
 * 时间：2024-08-31-10:19
 * 功能：
 */

@RestController
@RequestMapping("/api/oss")
public class OssController {

    @Autowired
    private FileService fileService;

    @PostMapping("/upload")
    public R upFile(@RequestParam("file")MultipartFile file) {
        String url = fileService.upload(file);
        return R.ok().data("imgUrl", url);
    }
}
